﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

namespace Gargoyle.ZZT
{
    public struct Location
    {
        public byte X;
        public byte Y;

        public Location(byte newX, byte newY)
        {
            X = newX;
            Y = newY;
        }

        public static bool operator ==(Location loc1, Location loc2)
        {
            return ((loc1.X == loc2.X) && (loc1.Y == loc2.Y));
        }

        public static bool operator !=(Location loc1, Location loc2)
        {
            return ((loc1.X != loc2.X) || (loc1.Y != loc2.Y));
        }

        public Location Add(Location source)
        {
            return new Location((byte)(X + source.X), (byte)(Y + source.Y));
        }

        public Location Add(Vector vector)
        {
            return new Location((byte)(X + vector.X), (byte)(Y + vector.Y));
        }

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public Location Subtract(Location source)
        {
            return new Location((byte)(X - source.X), (byte)(Y - source.Y));
        }

        public Location Subtract(Vector vector)
        {
            return new Location((byte)(X - vector.X), (byte)(Y - vector.Y));
        }

        public Point ToPoint()
        {
            return new Point(X, Y);
        }

        public override string ToString()
        {
            return "Location (" + X.ToString() + ", " + Y.ToString() + ")";
        }

    }
}
